"""
利用Python进行数据分析

pandas
"""
import numpy as np
from pandas import Series, DataFrame
import pandas as pd


def main():
    data = np.loadtxt('xiongmao.txt', dtype=int, delimiter=',')
    # print(data)
    frame = DataFrame(data, columns=['年龄', '性别', '地区', '金额', '周期', '类型', '状态'])
    # print(frame)

    # 产生多个汇总统计
    # print(frame.describe())

    # 转置
    # print(frame.T)

    # 返回列小结
    # print(frame.sum())
    # print(frame.sum(axis=0))

    # print(frame['金额'])
    # print(np.array(frame['金额']).min())

    # print(frame.ix[0])
    # print(frame.ix[0][1])
    # print(frame.ix[0, 2])

    # print(frame.sort_index())

    # 导出数据CSV
    # frame.to_csv("xm.csv", encoding="utf-8", index=False)


if __name__ == "__main__":
    main()
